#!/usr/bin/env bash
# shellcheck disable=SC2145,SC2124
# shellcheck source=/dev/null

abs_path="$(builtin cd "$(dirname "${0}")" && builtin pwd)"
declare abs_path
source "${abs_path%/*}/libexec/lab-error"

function judge() {
    {
        [[ "${#@}" != 6 ]] && error

        {
            readonly test_a=${@:1:1}
            readonly test_b=${@:2:1}
            readonly test_c=${@:3:1}
            readonly test_d=${@:4:1}
            readonly test_e=${@:5:1}
            readonly test_f=${@:6:1}

            test_all=(
                "${test_a/L*=/}"
                "${test_b/a*=/}"
                "${test_c/b*=/}"
                "${test_d/L*=/}"
                "${test_e/a*=/}"
                "${test_f/b*=/}"
            )
            readonly test_all

            for ((i = 0; i < "${#test_all[@]}"; i++)); do
                grep -q "^-\?[0-9]\+\.\?[0-9]*$" <<<"${test_all[i]}" || error
            done
        }
    }
}
